let ss = {}
import moment from "moment"
moment.locale("zh-cn")
ss.install = function (Vue) {
    Vue.filter('time', (v,type='YYYY-MM-DD hh:mm:ss') => {
        // console.log(v);
        // var t = new Date(v)
        // var y = t.getFullYear()
        // var m = (t.getMonth() + 1).toString().padStart(2, 0)
        // var d = t.getDate().toString().padStart(2, 0)
        // var h = t.getHours().toString().padStart(2, 0)
        // var M = t.getMinutes().toString().padStart(2, 0)
        // var s = t.getSeconds().toString().padStart(2, 0)

        // return `${y}/${m}/${d} ${h}:${M}:${s}`

        return moment(v*1000).format(type)
    })



    Vue.filter('time1', (v) => {
        // console.log(v);
        switch (v) {
            case 0:
                return '一级'
            case 1:
                return '二级'
            case 2:
                return '三级'
            default:
                return '一级'
        }
    })

    Vue.filter('time2', (v) => {
        // console.log(v);
        switch (v) {
            case 0:
                return ''
            case 1:
                return 'success'
            case 2:
                return 'warning'
            default:
                return ''
        }
    })

    
}
export default ss